﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace DAL.Migrations
{
    public partial class gx : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "ChargeType",
                columns: table => new
                {
                    ChargeType_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ChargeType_Name = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ChargeType", x => x.ChargeType_Id);
                });

            migrationBuilder.CreateTable(
                name: "Discount",
                columns: table => new
                {
                    Discount_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Discount_Name = table.Column<string>(nullable: true),
                    Discount_Rate = table.Column<decimal>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Discount", x => x.Discount_Id);
                });

            migrationBuilder.CreateTable(
                name: "Doctor",
                columns: table => new
                {
                    Doctor_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Doctor_number = table.Column<string>(nullable: true),
                    Doctor_Name = table.Column<string>(nullable: true),
                    Doctor_Sex = table.Column<string>(nullable: true),
                    Doctor_Age = table.Column<string>(nullable: true),
                    Outpatient_Id = table.Column<int>(nullable: false),
                    Professional_Id = table.Column<int>(nullable: false),
                    Doctor_Iphone = table.Column<string>(nullable: true),
                    Doctor_State = table.Column<string>(nullable: true),
                    State = table.Column<int>(nullable: false),
                    Doctor_Home = table.Column<string>(nullable: true),
                    Doctor_IDnumber = table.Column<string>(nullable: true),
                    Doctor_Birthday = table.Column<string>(nullable: true),
                    Doctor_Email = table.Column<string>(nullable: true),
                    Doctor_Remark = table.Column<string>(nullable: true),
                    Doctor_IDnumberPicture = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Doctor", x => x.Doctor_Id);
                });

            migrationBuilder.CreateTable(
                name: "MenuInfo",
                columns: table => new
                {
                    Menu_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Menu_Name = table.Column<string>(nullable: true),
                    Menu_Url = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MenuInfo", x => x.Menu_Id);
                });

            migrationBuilder.CreateTable(
                name: "Outcall",
                columns: table => new
                {
                    Outcalls_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Outcalls_number = table.Column<string>(nullable: true),
                    Patient_Id = table.Column<int>(nullable: false),
                    Doctor_Id = table.Column<int>(nullable: false),
                    Outpatient_Id = table.Column<int>(nullable: false),
                    Outcalls_State = table.Column<string>(nullable: true),
                    State = table.Column<int>(nullable: false),
                    Registration = table.Column<string>(nullable: true),
                    Outcalls_Remark = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Outcall", x => x.Outcalls_Id);
                });

            migrationBuilder.CreateTable(
                name: "Outpatient",
                columns: table => new
                {
                    Outpatient_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Outpatient_Name = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Outpatient", x => x.Outpatient_Id);
                });

            migrationBuilder.CreateTable(
                name: "Patient",
                columns: table => new
                {
                    Patient_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Patient_Num = table.Column<string>(nullable: true),
                    Patient_Name = table.Column<string>(nullable: true),
                    Patient_Sex = table.Column<string>(nullable: true),
                    Patient_Age = table.Column<string>(nullable: true),
                    Outpatient_Id = table.Column<int>(nullable: false),
                    Patient_Date = table.Column<string>(nullable: true),
                    Patient_State = table.Column<string>(nullable: true),
                    Streat = table.Column<int>(nullable: false),
                    Patient_IDnumber = table.Column<string>(nullable: true),
                    Patient_Birthday = table.Column<string>(nullable: true),
                    Patient_IPhone = table.Column<string>(nullable: true),
                    Patient_Email = table.Column<string>(nullable: true),
                    Patient_Home = table.Column<string>(nullable: true),
                    Patient_File = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Patient", x => x.Patient_Id);
                });

            migrationBuilder.CreateTable(
                name: "PatientInfor",
                columns: table => new
                {
                    PatientInfor_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PatientInfor_registration = table.Column<int>(nullable: false),
                    PatientInfor_Date = table.Column<int>(nullable: false),
                    Outpatient_Id = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PatientInfor", x => x.PatientInfor_Id);
                });

            migrationBuilder.CreateTable(
                name: "Payment",
                columns: table => new
                {
                    Payment_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Patient_Id = table.Column<int>(nullable: false),
                    Doctor_Id = table.Column<int>(nullable: false),
                    Outpatient_Id = table.Column<int>(nullable: false),
                    Payment_Sum = table.Column<decimal>(nullable: false),
                    ChargeType_Id = table.Column<int>(nullable: false),
                    Discount_Id = table.Column<int>(nullable: false),
                    Payment_Actual = table.Column<decimal>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Payment", x => x.Payment_Id);
                });

            migrationBuilder.CreateTable(
                name: "Professional",
                columns: table => new
                {
                    Professional_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Professional_Name = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Professional", x => x.Professional_Id);
                });

            migrationBuilder.CreateTable(
                name: "RoleInfo",
                columns: table => new
                {
                    Role_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Role_Name = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoleInfo", x => x.Role_Id);
                });

            migrationBuilder.CreateTable(
                name: "RoleMenu",
                columns: table => new
                {
                    RoleMenu_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Role_Id = table.Column<int>(nullable: false),
                    Menu_Id = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoleMenu", x => x.RoleMenu_Id);
                });

            migrationBuilder.CreateTable(
                name: "RoomIntensive",
                columns: table => new
                {
                    RoomIntensive_Id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoomIntensive_Number = table.Column<string>(nullable: true),
                    RoomType_Id = table.Column<int>(nullable: false),
                    Patient_Id = table.Column<int>(nullable: false),
                    RoomIntensive_TimeBegin = table.Column<string>(nullable: true),
                    RoomIntensive_TimeEnd = table.Column<string>(nullable: true),
                    Doctor_Id = table.Column<int>(nullable: false),
                    RoomIntensive_State = table.Column<int>(nullable: false),
                    RoomIntensive_Remark = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoomIntensive", x => x.RoomIntensive_Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ChargeType");

            migrationBuilder.DropTable(
                name: "Discount");

            migrationBuilder.DropTable(
                name: "Doctor");

            migrationBuilder.DropTable(
                name: "MenuInfo");

            migrationBuilder.DropTable(
                name: "Outcall");

            migrationBuilder.DropTable(
                name: "Outpatient");

            migrationBuilder.DropTable(
                name: "Patient");

            migrationBuilder.DropTable(
                name: "PatientInfor");

            migrationBuilder.DropTable(
                name: "Payment");

            migrationBuilder.DropTable(
                name: "Professional");

            migrationBuilder.DropTable(
                name: "RoleInfo");

            migrationBuilder.DropTable(
                name: "RoleMenu");

            migrationBuilder.DropTable(
                name: "RoomIntensive");
        }
    }
}
